const adminDao = require('../../app/facade/admin.facade.js'),
    _ = require('lodash');
const socketIo = require('socket.io');

module.exports = {
    login: login
}

function login(req, res, next) {
    console.log("---------------------------------")
    console.log(socketIo);
    console.log("---------------------------------")

    let admin = req.body;
    if (_.isEmpty(admin.username || _.isEmpty(admin.password))) {
        res.json('params is empty');
    } else {
        adminDao.getAdminByLogin(admin, (error, result) => {
            if (error) return next(error, req, res);
            if (null != result)
                result.password = "";
            res.json(result);
        });
    }
}

